//
//  ZZCChangePhoneOneController.m
//  ZZC-Finance
//
//  Created by mac on 2017/5/23.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "ZZCChangePhoneOneController.h"
#import "ZZCChangePhoneTwoController.h"

@interface ZZCChangePhoneOneController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *phoneTextField;

@end

@implementation ZZCChangePhoneOneController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"换绑手机号";
    self.phoneTextField.delegate = self;
    [self.phoneTextField becomeFirstResponder];
}

//下一步
- (IBAction)nextClick {
    ZZCChangePhoneTwoController *phone = [ZZCChangePhoneTwoController new];
    phone.phoneNumber = _phoneTextField.text;
    [self.navigationController pushViewController:phone animated:YES];
}


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if (textField == self.phoneTextField) {
        //用来做长度限制；
        if (range.location>=11) {
            return NO;
        }
    }
    return YES;
    
}

@end
